/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.star.common;

import java.io.Serializable;

/**
 *
 * @author ngotandieu
 */
public class PostData implements Serializable {

    String id;
    String title;
    String slug;
    String desc;
    String content;
    long published;
    String author;
    String editor;
    long updated;
    long created;
    int status;
    String site;
    String thumbFb;
    String tags;
    String authorNews;
    
    // contructor for add new
    public PostData(String title, String slug, String desc, String content, 
            String author, int status, long published, String site, 
            String thumbFb, String tags, String authorNews) {
        this.title = title;
        this.slug = slug.equalsIgnoreCase("") ? CommonUtil.URLFriendly(title) : slug;
        this.desc = desc;
        this.content = content;
        this.published = published;
        this.author = author;
        this.editor = author;
        this.updated = System.currentTimeMillis()/1000L;
        this.created = System.currentTimeMillis()/1000L;
        this.status = status;
        this.site = site;
        this.thumbFb = thumbFb;
        this.tags = tags;
        this.authorNews = authorNews;
    }
    
    // contructor for edit
    public PostData(String id, String title, String slug, String desc, 
            String content, String editor, int status, 
            long published, String site, String thumbFb) {
        this.id = id;
        this.title = title;
        this.slug = slug.equalsIgnoreCase("") ? CommonUtil.URLFriendly(title) : slug;
        this.desc = desc;
        this.content = content;
        this.published = published;
        this.editor = editor;
        this.updated = System.currentTimeMillis()/1000L;
        this.status = status;
        this.site = site;
        this.thumbFb = thumbFb;
    }
    
    public PostData(String id, String title, String slug, String desc, String content, 
            String author, String editor, long updated, long created, 
            int status, long published, String site, String thumbFb, String tags, String authorNews) {        
        this.id = id;
        this.title = title;
        this.slug = slug.equalsIgnoreCase("") ? CommonUtil.URLFriendly(title) : slug;
        this.desc = desc;
        this.content = content;
        this.author = author;
        this.editor = editor;
        this.updated = updated;
        this.created = created;
        this.status = status;
        this.published = published;
        this.site = site;
        this.thumbFb = thumbFb;
        this.tags = tags;
        this.authorNews = authorNews;
    }

    public String getSite() {        
        return site != null ? site : "";
    }

    public String getThumbFb() {
        return thumbFb != null ? thumbFb : "";
    }
        
    public String getId() {
        return id;
    }

    public String getTitle() {
        return title != null ? title : "";
    }
    
    public String getSlug() {
        return slug != null ? slug : "";
    }

    public String getDesc() {
        return desc != null ? desc : "";
    }

    public String getContent() {
        return content != null ? content : "";
    }

    public String getAuthor() {
        return author != null ? author : "";
    }

    public String getEditor() {
        return editor != null ? editor : "";
    }

    public long getUpdated() {
        return updated;
    }

    public long getCreated() {
        return created;
    }

    public int getStatus() {
        return status;
    }

    public long getPublished() {
        return published;
    }

    public String getTags() {
        return tags != null ? tags : "";
    }    

    public String getAuthorNews() {
        return authorNews != null ? authorNews : "";
    }    
}
